@include('admin.header')

<style type="text/css">
  .opartion {
    width: 350px;
  }

  .pagination {
    list-style: none;
    float: right;
  }

  .pagination li {
    float: left;
    padding-left: 5px;
    padding-right: 5px;
  }

  .input_search {
    margin-top: 10px;
  }
</style>

<div class="wrap">
  <div class="margin-bottom-20">
    <!-- <a class="btn btn-primary edit"><i class="fa fa-plus"></i> 添加</a> -->
    {{ csrf_field() }}
    <input id="change_url" value="" type="hidden"/>
    <form action="{{url('basiconfig/transfer_rule')}}" method="post">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
        转出方类型：
        <select name="from_ownertype" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_None'>None</option>
          <option value='1_用户账户' @if($from_ownertype=='用户账户'){echo selected="selected";} @endif>用户账户</option>
          <option value='2_商家账户' @if($from_ownertype=='商家账户'){echo selected="selected";} @endif>商家账户</option>
          <option value='3_企业账户' @if($from_ownertype=='企业账户'){echo selected="selected";} @endif>企业账户</option>
          <option value='99_系统账户' @if($from_ownertype=='系统账户'){echo selected="selected";} @endif>系统账户</option>
        </select>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          转出方钱包类型：
        <select name="from_pursetype" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_None' @if($from_pursetype=='None'){echo selected="selected";} @endif>None</option>
          <option value='1_收益账户' @if($from_pursetype=='收益账户'){echo selected="selected";} @endif>收益账户</option>
          <option value='2_现金账户' @if($from_pursetype=='现金账户'){echo selected="selected";} @endif>现金账户</option>
          <option value='3_积分账户' @if($from_pursetype=='积分账户'){echo selected="selected";} @endif>积分账户</option>
          <option value='4_o2o收益账户' @if($from_pursetype=='o2o收益账户'){echo selected="selected";} @endif>o2o收益账户</option>
          <option value='96_过账账户' @if($from_pursetype=='过账账户'){echo selected="selected";} @endif>过账账户</option>
          <option value='97_授信账户' @if($from_pursetype=='授信账户'){echo selected="selected";} @endif>授信账户</option>
          <option value='98_中央银行账户' @if($from_pursetype=='中央银行账户'){echo selected="selected";} @endif>中央银行账户</option>
          <option value='99_系统收益账户' @if($from_pursetype=='系统收益账户'){echo selected="selected";} @endif>系统收益账户</option>
        </select>
        
      
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          状态：
        <select name="state" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_未启用' @if($state=='未启用'){echo selected="selected";} @endif>未启用</option>
          <option value='1_允许转账' @if($state=='允许转账'){echo selected="selected";} @endif>允许转账</option>
          <option value='2_禁止转账' @if($state=='禁止转账'){echo selected="selected";} @endif>禁止转账</option>
          <option value='3_宽松允许' @if($state=='宽松允许'){echo selected="selected";} @endif>宽松允许</option>
        </select>
        <br/>

          接收方类型：
        <select name="to_ownertype" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_None'  @if($to_ownertype=='None'){echo selected="selected";} @endif>None</option>
          <option value='1_用户账户'  @if($to_ownertype=='用户账户'){echo selected="selected";} @endif>用户账户</option>
          <option value='2_商家账户'  @if($to_ownertype=='商家账户'){echo selected="selected";} @endif>商家账户</option>
          <option value='3_企业账户'  @if($to_ownertype=='企业账户'){echo selected="selected";} @endif>企业账户</option>
          <option value='99_系统账户'  @if($to_ownertype=='系统账户'){echo selected="selected";} @endif>系统账户</option>
        </select>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           接收方钱包类型：
        <select name="to_pursetype" style="width: 120px;">
          <option value=''>--请选择--</option>
          <option value='0_None' @if($to_pursetype=='None'){echo selected="selected";} @endif>None</option>
          <option value='1_收益账户' @if($to_pursetype=='收益账户'){echo selected="selected";} @endif>收益账户</option>
          <option value='2_现金账户' @if($to_pursetype=='现金账户'){echo selected="selected";} @endif>现金账户</option>
          <option value='3_积分账户' @if($to_pursetype=='积分账户'){echo selected="selected";} @endif>积分账户</option>
          <option value='4_o2o收益账户' @if($to_pursetype=='o2o收益账户'){echo selected="selected";} @endif>o2o收益账户</option>
          <option value='96_过账账户' @if($to_pursetype=='过账账户'){echo selected="selected";} @endif>过账账户</option>
          <option value='97_授信账户' @if($to_pursetype=='授信账户'){echo selected="selected";} @endif>授信账户</option>
          <option value='98_中央银行账户' @if($to_pursetype=='中央银行账户'){echo selected="selected";} @endif>中央银行账户</option>
          <option value='99_系统收益账户' @if($to_pursetype=='系统收益账户'){echo selected="selected";} @endif>系统收益账户</option>
        </select>


          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <span class="text-c">
            <button name="" id="search" class="btn btn-success user_search" type="
            submit"><i class="Hui-iconfont"></i> 搜索</button>
            </span>
            <span class="r">共有数据：<strong>{{$data->total()}}</strong> 条</span>
        </div>
    </form>
      <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a class="btn btn-primary radius" id="add_rule">添加</a></span> </div>
  </div>
  <form class="form-horizontal js-ajax-form" method="post" novalidate="novalidate">
    <table class="table table-hover table-bordered">
      <thead>
      <tr>
        <th>规则编号</th>
        <th>转出方类型</th>
        <th>转出方钱包类型 </th>
        <th>接收方类型</th>
        <th>接收方钱包类型</th>
        <th>状态</th>
        <th>是否要求用户相同</th>
        <th>是否要求子账号相同</th>
        <th>备注</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      @foreach($data as $val)
      <tr>
        <td>{{$val->ruleid}}</td>
        <td>
          @if($val->from_ownertype == 0)
              <span>None</span>
          @elseif($val->from_ownertype == 1)
              <span>用户账户</span>
          @elseif($val->from_ownertype == 2)
              <span>商家账户</span>
          @elseif($val->from_ownertype == 3)
              <span>企业账户</span>
          @else
              <span>系统账户</span>    
          @endif
        </td>
        <td>
          @if($val->from_pursetype == 0)
              <span>None</span>
          @elseif($val->from_pursetype == 1)
              <span>收益账户</span>
          @elseif($val->from_pursetype == 2)
              <span>现金账户</span>
          @elseif($val->from_pursetype == 3)
              <span>积分账户</span>
          @elseif($val->from_pursetype == 4)
              <span>o2o收益账户</span>    
          @elseif($val->from_pursetype == 96)
              <span>过账账户</span>    
          @elseif($val->from_pursetype == 97)
              <span>授信账户</span>    
          @elseif($val->from_pursetype == 98)
              <span>中央银行账户</span>            
          @else
              <span>系统收益账户</span>    
          @endif
        </td>
        <td>
          @if($val->to_ownertype == 0)
              <span>None</span>
          @elseif($val->to_ownertype == 1)
              <span>用户账户</span>
          @elseif($val->to_ownertype == 2)
              <span>商家账户</span>
          @elseif($val->to_ownertype == 3)
              <span>企业账户</span>
          @else
              <span>系统账户</span>    
          @endif
        </td>
        <td>
         @if($val->to_pursetype == 0)
              <span>None</span>
          @elseif($val->to_pursetype == 1)
              <span>收益账户</span>
          @elseif($val->to_pursetype == 2)
              <span>现金账户</span>
          @elseif($val->to_pursetype == 3)
              <span>积分账户</span>
          @elseif($val->to_pursetype == 4)
              <span>o2o收益账户</span>    
          @elseif($val->to_pursetype == 96)
              <span>过账账户</span>    
          @elseif($val->to_pursetype == 97)
              <span>授信账户</span>    
          @elseif($val->to_pursetype == 98)
              <span>中央银行账户</span>            
          @else
              <span>系统收益账户</span>    
          @endif
        </td> 
        <td>
          @if($val->state == 0)
              <span>未启用</span>
          @elseif($val->state == 1)
              <span>允许转账</span>
          @elseif($val->state == 2)
              <span>禁止转账</span>
          @else
              <span>宽松允许</span>    
          @endif
        </td>
        <td>
          @if($val->same_ownerid == 0)
              <span>否</span>
          @else
              <span>是</span>    
          @endif
        </td>
        <td>
          @if($val->same_subid == 0)
              <span>否</span>
          @else
              <span>是</span>    
          @endif
        </td>
        <td>{{$val->remark}}</td>
        <td>
         <span><a _id="{{$val->ruleid}}" class="edit_rule">编辑</a></span> ｜
          <a href="javascript:void(0)" rel="{{$val->ruleid}}" class="js-rule-delete">删除</a>
        </td>
      </tr>
      @endforeach
      </tbody>
    </table>

    <!-- 分页 -->
    @if (!empty($data))
    <div class="page_list">
        {{$data->links()}}
    </div>
    @endif
  </form>
</div>

<script>
$(function(){
      //添加规则
    $('#add_rule').click(function() {
      open_iframe_layer('/basiconfig/add_rule?id='+'add');
    });

    //编辑规则
    $('.edit_rule').click(function() {
      var id = $(this).attr('_id') || 0;
      open_iframe_layer('/basiconfig/add_rule?ruleid='+id);
    });

    $('.js-rule-delete').click(function(){
    var id = $(this).attr('rel');
    layer.confirm('你确定要删除吗？', {
      btn: ['确定','取消']
    }, function(){
      $.post('{{asset("basiconfig/del")}}',{id:id},function (msg) {
        if(msg.status == 1){
          layer.alert(msg.info, {
            title: '提示',
            icon: 1,
          });
          window.location.href = '{{asset("basiconfig/transfer_rule")}}';
        }else{
          layer.alert(msg.info, {
            title: '提示',
            icon: 2,
          });
        }
      },'json');
    },function() {

    });
  });
});
//详情
// $('.apply_action').click(function() {
//   var id = $(this).attr('_id');
//    if(confirm("确定要审核通过吗？")){
//       $.ajax({
//             type: 'GET',
//             url: '/system/apply_action?id='+id,
//             dataType: 'json',
//             success: function(data){
               
//             },
           
//          });
//    }
        
//    });


</script>